﻿using System;
using System.Text;

namespace ConvertEncodings
{
    public class Program
    {
        public static void PrintBytes(byte[] array)
        {
            foreach (byte b in array)
            {
                Console.Write("0x{0:X} ", b);
            }
            Console.WriteLine();
        }

        public static void Main()
        {
            string input = Console.ReadLine();
            Console.WriteLine();

            byte[] utf8Bytes = Encoding.UTF8.GetBytes(input);
            Console.WriteLine("UTF8:");
            PrintBytes(utf8Bytes);
            Console.WriteLine(Encoding.UTF8.GetString(utf8Bytes));
            Console.WriteLine();

            byte[] asciiBytes = Encoding.ASCII.GetBytes(input);
            Console.WriteLine("ASCII:");
            PrintBytes(asciiBytes);
            Console.WriteLine(Encoding.ASCII.GetString(utf8Bytes));
            Console.WriteLine();

            Encoding win1251Encoding = Encoding.GetEncoding("windows-1251");
            var win1251Bytes = win1251Encoding.GetBytes(input);
            Console.WriteLine("windows-1251:");
            PrintBytes(win1251Bytes);
            Console.WriteLine(win1251Encoding.GetString(win1251Bytes));
        }
    }
}
